package main

import (
	"flag"
	"htgis/monitor/module/agent/cron"
	"htgis/monitor/module/agent/http"
	"htgis/monitor/module/agent/metric"
	"htgis/monitor/module/agent/util"
)

func main() {
	// read configuration from cfg.json
	cfg := flag.String("c", "cfg.json", "configuration file")
	flag.Parse()
	// parse configuration
	util.ParseConfig(*cfg)
	// init 
	util.InitRootDir()
	util.InitLocalIP()
	// build metrics mapper
	metric.BuildMappers()
	// collect data
	cron.Collect()
	// start http server
	go http.Start("localhost:8000")
	// wait until exit
	select {}
}
